package cn.gs.filter;

import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;


public class WorkbenchInterfaceFilter extends HttpServletResponseWrapper {

    //字符数组writer
    private CharArrayWriter charArrayWriter = new CharArrayWriter();

    /**
     * Constructs a response adaptor wrapping the given response.
     *
     * @param response The response to be wrapped
     * @throws IllegalArgumentException if the response is null
     */
    public WorkbenchInterfaceFilter(HttpServletResponse response) {
        super(response);
    }

    //覆盖父类方法
    @Override
    public PrintWriter getWriter() throws IOException {
        return new PrintWriter(charArrayWriter);
    }

    public CharArrayWriter getCharArrayWriter() {
        return charArrayWriter;
    }

}
